package com.sy.controller;

import com.sy.dto.Params;
import com.sy.dto.TrainerDto;
import com.sy.dto.TrainersDto;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
public class TrainerController extends BaseController {
    @RequestMapping(value = "trainer/params", method = RequestMethod.POST)
    public List<TrainersDto> getTrainerDtoListByParams(@RequestBody Params params){
        return trainerService.getTrainerByParams(params);
    }
    @RequestMapping(value = "trainer", method = RequestMethod.GET,params = {"type=showTrainer"})
    public TrainerDto getTrainerById(Integer id){
        return trainerService.getTrainerById(id);
    }
    @RequestMapping(value = "trainer", method = RequestMethod.POST)
    public Integer getCountByParams(@RequestBody Params params){
        return trainerService.getCountByParams(params);
    }
}
